<template>
  <n-icon v-bind="iconProps">
    <svg class="icon" aria-hidden="true" v-if="svg">
      <use xlink:href="#icon-system"></use>
    </svg>
  </n-icon>
</template>
<script setup name="SIcon">
import * as Icons from "@vicons/ionicons5";

const props = defineProps({
  icon:{
    type:String
  },
  svg:{
    type:Boolean,
    default:false
  }
})
const iconProps = computed(()=>{
  if (props.icon){
    if (Icons[props.icon]){
      return {component:Icons[props.icon]}
    }else if (!props.svg){
      return {class:['iconfont',props.icon]}
    }
  }
  return undefined;
})

</script>